/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.is.ga;

import java.util.LinkedList;

/**
 *
 * @author oleg
 */
public class ChromosomeGenerator{
        int count;
        LinkedList<Integer> list=new LinkedList<Integer>();

        public ChromosomeGenerator(int count) {
            this.count = count;
            for(int i=0;i<count;i++)
                list.add(i);
        }

        public int getRandom(){
            int i=(int)(Math.random()*list.size());
            int result=list.get(i);
            list.remove(i);
            return result;
        }

        public void exclude(LinkedList<Integer> ex_list){
            Object[] toArray = ex_list.toArray();
            for(int i=0;i<toArray.length;i++){
                Object value=toArray[i];
                list.remove(value);
            }
        }
    }